home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 7
/
Aminet 7 - August 1995.iso
/
Aminet
/
util
/
misc
/
NVX_timeul2.lha
/
C_Source.lha
/
GUI.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-09-02
|
10KB
|
386 lines
/*
* Source machine generated by GadToolsBox V2.0b
* which is (c) Copyright 1991-1993 Jaba Development
*
* GUI Designed by : M.Meany, © MMSoftware.
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/imageclass.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/utility_protos.h>
#include <string.h>
#include "GUI.h"
struct Screen *Scr = NULL;
UBYTE *PubScreenName = NULL;
APTR VisualInfo = NULL;
struct Window *MarksWnd = NULL;
struct Window *Project1Wnd = NULL;
struct Gadget *MarksGList = NULL;
struct Gadget *Project1GList = NULL;
struct IntuiMessage MarksMsg;
struct IntuiMessage Project1Msg;
UWORD MarksZoom[4];
struct Gadget *MarksGadgets[10];
struct Gadget *Project1Gadgets[1];
UWORD MarksLeft = 144;
UWORD MarksTop = 33;
UWORD MarksWidth = 358;
UWORD MarksHeight = 172;
UWORD Project1Left = 152;
UWORD Project1Top = 57;
UWORD Project1Width = 345;
UWORD Project1Height = 96;
UBYTE *MarksWdt = (UBYTE *)"NVX Upload Calculator";
UBYTE *Project1Wdt = (UBYTE *)"About This Great Util ;-)";
UBYTE *Gadget100Labels[] = {
(UBYTE *)"300",
(UBYTE *)"1200",
(UBYTE *)"2400",
(UBYTE *)"4800",
(UBYTE *)"9600",
(UBYTE *)"14400",
(UBYTE *)"16800",
(UBYTE *)"19200",
(UBYTE *)"21600",
(UBYTE *)"28800",
NULL };
struct TextAttr topaz8 = {
( STRPTR )"topaz.font", 8, 0x00, 0x01 };
struct IntuiText MarksIText[] = {
1, 0, JAM1,7, 17, &topaz8, (UBYTE *)"Baud Rate", &MarksIText[1],
1, 0, JAM1,94, 6, &topaz8, (UBYTE *)"Filename", &MarksIText[2],
1, 0, JAM1,234, 6, &topaz8, (UBYTE *)"Size (Bytes)", NULL };
struct IntuiText Project1IText[] = {
1, 0, JAM1,63, 1, &topaz8, (UBYTE *)"Programmed by: STIGG // NVX", &Project1IText[1],
1, 0, JAM1,9, 27, &topaz8, (UBYTE *)"Trick Or Treat II", &Project1IText[2],
1, 0, JAM1,9, 36, &topaz8, (UBYTE *)"+44 (0)1703 391797", &Project1IText[3],
1, 0, JAM1,45, 53, &topaz8, (UBYTE *)"The Edge", &Project1IText[4],
1, 0, JAM1,10, 63, &topaz8, (UBYTE *)"+44 (0)1226 289303", &Project1IText[5],
1, 0, JAM1,227, 27, &topaz8, (UBYTE *)"13th Hour", &Project1IText[6],
1, 0, JAM1,186, 36, &topaz8, (UBYTE *)"+44 (0)1704 505845", &Project1IText[7],
1, 0, JAM1,220, 53, &topaz8, (UBYTE *)"Power Plant", &Project1IText[8],
1, 0, JAM1,186, 62, &topaz8, (UBYTE *)"+44 (0)1229 431590", &Project1IText[9],
1, 0, JAM1,50, 14, &topaz8, (UBYTE *)"___Call these fine NVX BBS's___", NULL };
UWORD MarksGTypes[] = {
LISTVIEW_KIND,
MX_KIND,
TEXT_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
TEXT_KIND,
NUMBER_KIND,
BUTTON_KIND
};
UWORD Project1GTypes[] = {
BUTTON_KIND
};
struct NewGadget MarksNGad[] = {
84, 15, 260, 120, NULL, NULL, GD_Gadget00, 0, NULL, (APTR)Gadget00Clicked,
63, 25, 17, 9, NULL, NULL, GD_Gadget10, PLACETEXT_LEFT, NULL, (APTR)Gadget10Clicked,
224, 157, 119, 11, (UBYTE *)"Est. UL Time:", NULL, GD_Gadget20, PLACETEXT_LEFT, NULL, NULL,
84, 131, 92, 12, (UBYTE *)"_Add", NULL, GD_Gadget30, PLACETEXT_IN, NULL, (APTR)Gadget30Clicked,
177, 131, 88, 12, (UBYTE *)"_Delete", NULL, GD_Gadget40, PLACETEXT_IN, NULL, (APTR)Gadget40Clicked,
265, 131, 79, 12, (UBYTE *)"_Clear", NULL, GD_Gadget50, PLACETEXT_IN, NULL, (APTR)Gadget50Clicked,
5, 131, 78, 12, (UBYTE *)"About", NULL, GD_Gadget60, PLACETEXT_IN, NULL, (APTR)Gadget60Clicked,
196, 145, 147, 11, (UBYTE *)"Total Size:", NULL, GD_Gadget70, PLACETEXT_LEFT, NULL, NULL,
36, 157, 63, 11, (UBYTE *)"CPS", NULL, GD_Gadget80, PLACETEXT_LEFT, NULL, NULL,
5, 116, 78, 15, (UBYTE *)"_Help", NULL, GD_Gadget90, PLACETEXT_IN, NULL, (APTR)Gadget90Clicked
};
struct NewGadget Project1NGad[] = {
92, 78, 153, 12, (UBYTE *)"That's Just Dandy!", NULL, GD_Gadget01, PLACETEXT_IN, NULL, (APTR)Gadget01Clicked
};
ULONG MarksGTags[] = {
(GTLV_ShowSelected), NULL, (TAG_DONE),
(GTMX_Labels), (ULONG)&Gadget100Labels[ 0 ], (TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE),
(GTNM_Number), 30, (GTNM_Border), TRUE, (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE)
};
ULONG Project1GTags[] = {
(TAG_DONE)
};
int SetupScreen( void )
{
if ( ! ( Scr = LockPubScreen( PubScreenName )))
return( 1L );
if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
return( 2L );
return( 0L );
}
void CloseDownScreen( void )
{
if ( VisualInfo ) {
FreeVisualInfo( VisualInfo );
VisualInfo = NULL;
}
if ( Scr ) {
UnlockPubScreen( NULL, Scr );
Scr = NULL;
}
}
void MarksRender( void )
{
UWORD offx, offy;
offx = MarksWnd->BorderLeft;
offy = MarksWnd->BorderTop;
DrawBevelBox( MarksWnd->RPort, offx + 84, offy + 4, 260, 11, GT_VisualInfo, VisualInfo, TAG_DONE );
DrawBevelBox( MarksWnd->RPort, offx + 5, offy + 15, 78, 101, GT_VisualInfo, VisualInfo, TAG_DONE );
PrintIText( MarksWnd->RPort, MarksIText, offx, offy );
}
int HandleMarksIDCMP( void )
{
struct IntuiMessage *m;
int (*func)();
BOOL running = TRUE;
while( m = GT_GetIMsg( MarksWnd->UserPort )) {
CopyMem(( char * )m, ( char * )&MarksMsg, (long)sizeof( struct IntuiMessage ));
GT_ReplyIMsg( m );
switch ( MarksMsg.Class ) {
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh( MarksWnd );
MarksRender();
GT_EndRefresh( MarksWnd, TRUE );
break;
case IDCMP_CLOSEWINDOW:
running = MarksCloseWindow();
break;
case IDCMP_VANILLAKEY:
running = MarksVanillaKey();
break;
case IDCMP_GADGETUP:
case IDCMP_GADGETDOWN:
func = ( void * )(( struct Gadget * )MarksMsg.IAddress )->UserData;
running = func();
break;
case IDCMP_MENUPICK:
break;
}
}
return( running );
}
int OpenMarksWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
if ( ! ( g = CreateContext( &MarksGList )))
return( 1L );
for( lc = 0, tc = 0; lc < Marks_CNT; lc++ ) {
CopyMem((char * )&MarksNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = &topaz8;
ng.ng_LeftEdge += offx;
ng.ng_TopEdge += offy;
MarksGadgets[ lc ] = g = CreateGadgetA((ULONG)MarksGTypes[ lc ], g, &ng, ( struct TagItem * )&MarksGTags[ tc ] );
while( MarksGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
MarksZoom[0] = MarksZoom[1] = 0;
if ( MarksWdt )
MarksZoom[2] = TextLength( &Scr->RastPort, (UBYTE *)MarksWdt, strlen((char *)MarksWdt )) + 80;
else
MarksZoom[2] = 80L;
MarksZoom[3] = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
if ( ! ( MarksWnd = OpenWindowTags( NULL,
WA_Left, MarksLeft,
WA_Top, MarksTop,
WA_Width, MarksWidth,
WA_Height, MarksHeight + offy,
WA_IDCMP, LISTVIEWIDCMP|MXIDCMP|TEXTIDCMP|BUTTONIDCMP|NUMBERIDCMP|IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE|WFLG_RMBTRAP,
WA_Gadgets, MarksGList,
WA_Title, MarksWdt,
WA_ScreenTitle, " Nerve Axis",
WA_PubScreen, Scr,
WA_Zoom, MarksZoom,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( MarksWnd, NULL );
MarksRender();
return( 0L );
}
void CloseMarksWindow( void )
{
if ( MarksWnd ) {
CloseWindow( MarksWnd );
MarksWnd = NULL;
}
if ( MarksGList ) {
FreeGadgets( MarksGList );
MarksGList = NULL;
}
}
void Project1Render( void )
{
UWORD offx, offy;
offx = Project1Wnd->BorderLeft;
offy = Project1Wnd->BorderTop;
PrintIText( Project1Wnd->RPort, Project1IText, offx, offy );
}
int HandleProject1IDCMP( void )
{
struct IntuiMessage *m;
int (*func)();
BOOL running = TRUE;
while( m = GT_GetIMsg( Project1Wnd->UserPort )) {
CopyMem(( char * )m, ( char * )&Project1Msg, (long)sizeof( struct IntuiMessage ));
GT_ReplyIMsg( m );
switch ( Project1Msg.Class ) {
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh( Project1Wnd );
Project1Render();
GT_EndRefresh( Project1Wnd, TRUE );
break;
case IDCMP_CLOSEWINDOW:
running = Project1CloseWindow();
break;
case IDCMP_GADGETUP:
func = ( void * )(( struct Gadget * )Project1Msg.IAddress )->UserData;
running = func();
break;
}
}
return( running );
}
int OpenProject1Window( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
if ( ! ( g = CreateContext( &Project1GList )))
return( 1L );
for( lc = 0, tc = 0; lc < Project1_CNT; lc++ ) {
CopyMem((char * )&Project1NGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = &topaz8;
ng.ng_LeftEdge += offx;
ng.ng_TopEdge += offy;
Project1Gadgets[ lc ] = g = CreateGadgetA((ULONG)Project1GTypes[ lc ], g, &ng, ( struct TagItem * )&Project1GTags[ tc ] );
while( Project1GTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( Project1Wnd = OpenWindowTags( NULL,
WA_Left, Project1Left,
WA_Top, Project1Top,
WA_Width, Project1Width,
WA_Height, Project1Height + offy,
WA_IDCMP, BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE|WFLG_RMBTRAP,
WA_Gadgets, Project1GList,
WA_Title, Project1Wdt,
WA_ScreenTitle, " Nerve Axis",
WA_PubScreen, Scr,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( Project1Wnd, NULL );
Project1Render();
return( 0L );
}
void CloseProject1Window( void )
{
if ( Project1Wnd ) {
CloseWindow( Project1Wnd );
Project1Wnd = NULL;
}
if ( Project1GList ) {
FreeGadgets( Project1GList );
Project1GList = NULL;
}
}